package model;

import entity.TeacherClassDetails;
import iface.IModel;
import javax.swing.DefaultListModel;

/**
 *
 * @author Noi
 */
public class TeacherClassDetailsListModel extends DefaultListModel<TeacherClassDetails> implements IModel<TeacherClassDetails> {
    private manager.Manager manager;
    
    public TeacherClassDetailsListModel(manager.Manager manager) {
        this.manager = manager;
        this.loadDataToList();
    }
    
    private void loadDataToList() {
        for(int i = 0; i < this.manager.getSubjectDetailsManager().size(); i++) {
            if(this.manager.getSubjectDetailsManager().get(i).isStatus())
                this.addElement(this.manager.getSubjectDetailsManager().get(i));
        }
    }

    @Override
    public void add(TeacherClassDetails obj) {
        this.manager.getTeacherClassDetailsManager().add(obj);
        this.addElement(obj);
    }

    @Override
    public void replace(int index, TeacherClassDetails obj) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void remove(TeacherClassDetails obj) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void refresh() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    

}
